package net.entelijan.cobean.bind;

/**
 * Implementing classes hold comps that get will be updated if a setter method
 * of a java bean gets a new value.
 * 
 * Is usually used in an aspect. @see PropertyChangedAspect.
 */
public interface IModelChangeListener {

    /**
     * This method is called before anything was changed in the model.
     * @param oldVal The old value of the model that is currently displayed in the component.
     * @param newVal The new value that will be set to the model and that will have to be displayed
     */
    public void prepareComponent(Object oldVal, Object newVal);

    /**
     * Updates the bound component with the actual model value. 
     */
    public void updateComponent();

    /**
     * Needed if the property is invoked and the wildcard advisor for 'set*'
     * has to descide what model change listener to call.
     * TODO Can eventiually be removed if the binding could establishe an advisor for every binding that contains exactly one model change listener.
     */
    public String getPropertyName();

}
